package com.yunweiweishi.xuhuanpaltform.yuhuan_app.service.imp;


import com.yunweiweishi.xuhuanpaltform.yuhuan_app.dao.ExpertDao;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.pojo.Expert;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.service.ExpertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ExpertServiceImpl implements ExpertService {


    @Autowired
    private ExpertDao expertDao;


    /**
     *
     * 通过专家姓名进行查找
     * @param expertName
     * @return
     */
    @Override
    public Expert findExceptByExpertName(String expertName) {
        return expertDao.findExceptByExpertName(expertName);
    }

    @Override
    public Expert findExpertByPhoneNumber(String phoneNumber) {
        return expertDao.findExceptByPhoneNumber(phoneNumber);
    }

    @Override
    public Expert findExpertById(Long id) {
        return expertDao.findExpertById(id);
    }


    /**
     *添加专家
     * @param expert
     */
    @Override
    public void AddExpert(Expert expert) {
        expertDao.save(expert);
    }

    @Override
    public void UpdateExpertById(Expert expert) {
        expertDao.save(expert);
    }


    /**
     * 进行专家的删除
     * @param id
     */
    @Override
    public void deleteExpertById(Long id) {
        expertDao.deleteById(id);

    }


}
